# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=masscan
pkgver=1.3.2
pkgrel=1
pkgdesc='TCP port scanner, spews SYN packets asynchronously, scanning entire Internet in under 5 minutes'
url='https://github.com/robertdavidgraham/masscan'
arch=('loong64' 'x86_64')
license=('AGPL3')
depends=('glibc' 'libpcap')
source=(${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('b0709f6f937a0e86c6913407c3bc60187074395ffff7a7a2bb54b23824d72982510e44fb1b1e7dcba85c4ad25ab1a623597661db43d9046165ba865cd9bd5b27')
b2sums=('5509027c00871b2242e419ab7cf3f775d7ee46e1882a27c52447ca442432712d742c686acbf4daa7307b791da06effa23b8790fc0561a42a4e8ed4c2f0be7713')

prepare() {
  cd ${pkgname}-${pkgver}
  sed -r 's|(CFLAGS )=|\1+=|g' -i Makefile
}

build() {
  cd ${pkgname}-${pkgver}
  export CFLAGS+=" ${CPPFLAGS}"
  make CC=gcc
}

check() {
  cd ${pkgname}-${pkgver}
  make regress
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 644 doc/masscan.8 -t "${pkgdir}/usr/share/man/man8"
  install -Dm 644 README.md doc/masscan.8.markdown -t "${pkgdir}/usr/share/doc/${pkgname}"
}

# vim: ts=2 sw=2 et:
